# app/schemas/spot_schema.py
from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime


class SpotCreate(BaseModel):
    """新增景点"""
    name: str = Field(..., max_length=128, description="景点名称")
    city: str = Field(..., max_length=64, description="所属城市")
    description: Optional[str] = None
    cover_url: Optional[str] = None
    lng: Optional[str] = None
    lat: Optional[str] = None


class SpotUpdate(BaseModel):
    """修改景点（全部可选）"""
    name: Optional[str] = Field(None, max_length=128)
    city: Optional[str] = Field(None, max_length=64)
    description: Optional[str] = None
    cover_url: Optional[str] = None
    lng: Optional[str] = None
    lat: Optional[str] = None


class SpotOut(BaseModel):
    """返回景点"""
    id: int
    name: str
    city: str
    description: Optional[str]
    cover_url: Optional[str]
    lng: Optional[str]
    lat: Optional[str]
    created_at: datetime

    class Config:
        from_attributes = True